﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Umbraco.Forms.Core;

namespace ContourStrikesAgain.Providers.FieldTypes
{
    public class MemberLogin : FieldType
    {
        private Controls.MemberLogin mltxt;

        public MemberLogin()
        {
            this.Id = new Guid("DF85E612-E271-432B-AFAF-86442F6F869B");
            this.Name = "Member Login";
            this.Description = "make sure member login is unique";

            this.Icon = "textfield.png";
            this.DataType = FieldDataType.String;
            mltxt = new Controls.MemberLogin();
            _value = new List<object>();
        }


        private List<Object> _value = new List<object>();
        public override List<object> Values
        {
            get
            {
                _value.Add(mltxt.Value);

                return _value;
            }
            set
            {
                _value = value;
            }
        }

        public override System.Web.UI.WebControls.WebControl Editor
        {
            get
            {


                return mltxt;
            }
            set
            {
                base.Editor = value;
            }
        }

        public override string RenderPreview()
        {
            return "<input type=\"text\" class=\"textfield\" value=\"unique member login\"/>";
        }

        public override string RenderPreviewWithPrevalues(List<object> prevalues)
        {
            return RenderPreview();
        }

        public override bool SupportsRegex
        {
            get
            {
                return true;
            }
        }
    }
}